﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input; 
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Chaotic.Module.General.ViewModels;
using Telerik.Windows.Controls.FieldList;
using Telerik.Windows.Documents;
using Telerik.Windows.Documents.Fixed.FormatProviders.Text;
using Telerik.Windows.Documents.Layout;
using Telerik.Windows.Documents.Lists;
using Telerik.Windows.Documents.Model;
using Telerik.Windows.Documents.Model.Styles;
using Telerik.Windows.Documents.Spreadsheet.Expressions.Functions;

namespace Chaotic.Module.General.Views
{
    /// <summary>
    /// LogContent.xaml 的交互逻辑
    /// </summary>
    public partial class LogContent : UserControl
    { 
        public LogContent()
        {
            InitializeComponent();
            this.Loaded += LogContent_Loaded;
        }

        private void LogContent_Loaded(object sender, RoutedEventArgs e)
        {
            if (this.DataContext is LogContentViewModel viewModel)
            {
                viewModel.RichTextBox = this.editor;
                

                //找到父节点的RadDocking控件
                if (this.Parent is ContentControl contentControl)
                {
                    if (contentControl.Parent is Telerik.Windows.Controls.RadPane pane)
                    {
                        viewModel.FocusTabActive = () =>
                        {
                            //激活当前选项卡
                            pane.IsSelected = true;
                            pane.IsActive = true;
                        };
                    }
                }
            }
        }
    }
}
